{% extends 'frontend/base.html' %}
{% load i18n %}
{% load app_icon %}
{% block content %}
    <div class="row profile-page">
        <div class="col-12">
            <div class="card">
                <div class="card-body ipdetail">
                    <h3 class="card-title">Domain {% trans "detail" %}</h3>
                    <p class="card-description">
                    <ul class="list-ticked">
                        <li>{% trans "Domain" %}: {{ data.url }}</li>
                        <li>{% trans "Subdomain" %}: {{ sub_domain|length }}</li>
                        <li>{% trans "Last record time" %}: {{ data.published_from }}</li>
                        {% if data.proper %}
                            <li>{% trans "Domain own" %}:
                                {% for pp in data.proper %}
                                    <a
                                            href="{% url 'zc-detail' pp.1 %}">{{ pp.0 }}</a>&nbsp;
                                {% endfor %}
                            </li>
                        {% endif %}
                    </ul>
                    </p>

                    <div class="profile-body">
                        <ul class="nav tab-switch" role="tablist">
                            <li class="nav-item">
                                <a class="nav-link active show" id="user-profile-info-tab" data-toggle="pill"
                                   href="#user-profile-info" role="tab" aria-controls="user-profile-info"
                                   aria-selected="true">Basic</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" id="user-profile-activity-tab" data-toggle="pill"
                                   href="#user-profile-activity" role="tab" aria-controls="user-profile-activity"
                                   aria-selected="false">History record</a>
                            </li>
                        </ul>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="tab-content" id="profile-log-switch">
                                    <div class="tab-pane fade show active pr-3" id="user-profile-info"
                                         role="tabpanel" aria-labelledby="user-profile-info-tab">

                                        <div class="row mt-5 pb-4 border-bottom">
                                            <div class="col-12">
                                                <div class="d-flex align-items-start pb-3 border-bottom">
                                                    <div class="wrapper pl-4 col-12">
                                                        <ul class="list-ticked">
                                                            <li>Ip:
                                                                {% if ip_data %}
                                                                    <a href="{% url 'detail' ip_data.id %}">{{ ip_data.ip }}</a>
                                                                {% else %}
                                                                    <span>{{ data.ip }}</span>
                                                                {% endif %}
                                                            </li>
                                                            {% for u in uldata %}
                                                                <li>{{ u.0 }}: {{ u.1 }}</li>
                                                            {% endfor %}

                                                        </ul>
                                                    </div>
                                                </div>
                                                {% if data.bugs %}
                                                    <div class="d-flex align-items-start py-3 border-bottom">
                                                        <div class="wrapper pl-4 col-12">
                                                            <p class="font-weight-bold mb-0">{% trans "VULNERABILITY DETAIL" %}</p>
                                                            <ul class="list-ticked">
                                                                {% for k,v in data.bugs.items %}
                                                                    <li>{{ k }} : {{ v }}</li>
                                                                {% endfor %}
                                                            </ul>
                                                        </div>
                                                    </div>
                                                {% endif %}
                                                {% if data.app %}
                                                    <div class="d-flex align-items-start py-3">
                                                        <div class="wrapper pl-4">
                                                            <p class="font-weight-bold mb-0">{% trans "Technology" %}</p>
                                                            <br>
                                                            <small>
                                                                <ul>
                                                                    {% for app in data.app %}
                                                                        <li>
                                                                            {{ app|app_icon|safe }} {{ app }}
                                                                        </li>
                                                                    {% endfor %}
                                                                </ul>
                                                            </small>
                                                        </div>
                                                    </div>
                                                {% endif %}
                                                <pre>{{ data.headers }}<br/><br/>{{ data.body }}</pre>


                                            </div>
                                        </div>

                                        <div class="row">
                                            <div class="col-12 mt-5">
                                                <h5 class="mb-1">{% trans "Subdomain" %}</h5>
                                                <div class="new-accounts">
                                                    <div class="table-responsive"
                                                         style="padding-right:32px;margin-top:20px;">
                                                        <ul>
                                                            {% for domain in sub_domain %}
                                                                <li>
                                                                    <a href="{% url 'detail' domain.id %}">{{ domain.url }}</a>
                                                                    &nbsp;&nbsp;&nbsp;{% if domain.title %}{{ domain.title|truncatewords:30 }}{% endif %}
                                                                <ul>

                                                                    {% if domain.ip %}
                                                                        <li>
                                                                            ip:{{ domain.ip }}
                                                                        </li>
                                                                    {% endif %}
                                                                    {% if domain.app %}
                                                                        <li>
                                                                            {% for app in domain.app %}
                                                                                {{ app|app_icon|safe }}
                                                                            {% endfor %}
                                                                        </li>
                                                                    {% endif %}
                                                                    {% if domain.bugs %}
                                                                        <li>
                                                                            <label class="badge badge-danger">{% trans "warning" %}</label>
                                                                        </li>
                                                                    {% endif %}
                                                                </ul>
                                                                </li>

                                                            {% endfor %}
                                                        </ul>

                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="tab-pane fade" id="user-profile-activity" role="tabpanel"
                                         aria-labelledby="user-profile-activity-tab">
                                        <div class="horizontal-timeline">
                                            <section class="time-frame">
                                                <h4 class="section-time-frame">History</h4>
                                                {% for h in historys %}
                                                    <div class="event">
                                                        <p class="event-text"><a
                                                                href="{% url 'detail' h.meta.id %}">{{ h.url }}</a>
                                                        </p>
                                                        <div class="event-alert">
                                                            ip:{{ h.ip }}
                                                            {% if h.title %}
                                                                <br>
                                                                Title: {{ data.title }}
                                                            {% endif %}
                                                            {% if h.app %}
                                                                <br>
                                                                {% for app in h.app %}
                                                                    {{ app|app_icon|safe }}
                                                                {% endfor %}
                                                            {% endif %}
                                                        </div>
                                                        <div class="event-info">{{ h.published_from }}</div>
                                                    </div>
                                                {% endfor %}
                                            </section>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-3">
                                <h5 class="my-4">Third information</h5>
                                {{ third_infomation|safe }}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block extrascript %}
    <script src="/static/js/form-addons.js"></script>
{% endblock %}